﻿using System;
using System.Collections.Generic;

namespace CardsSimulator
{
    class Component
    {
        public ComponentType Type { get; private set; }
        public string Name { get; private set; }
        public int InitialNumberOfCards { get; private set; }

        public List<Card> Cards { get; private set; }

        public Component(ComponentType type, string name, int initialNumberOfCards)
        {
            Type = type;
            Name = name;
            InitialNumberOfCards = initialNumberOfCards;

            Cards = new List<Card>();
        }
        public Component(ComponentType type, string name)
        {
            Type = type;
            Name = name;

            Cards = new List<Card>();
        }
        public Component()
        { }
        
        public void Shuffle()
        {
            var rng = new Random();
            int n = Cards.Count;
            while (n > 1)
            {
                n--;
                var k = rng.Next(n + 1);
                var temp = Cards[k];
                Cards[k] = Cards[n];
                Cards[n] = temp;
            }  
        }
    }
}
